<div class="blade-content  __large-wide ng-scope" id="blade-content">
  <div class="blade-inner">
    <div class="inner-block">
      <form name="form" class="form" (submit)="onCreate()" [formGroup]="formGroup" novalidate>
        <div class="blade-static __bottom" *ngIf="currentBlade.isNew">
          <button class="btn" [disabled]="isDisabled || !formGroup.valid" >创建</button>
        </div>

        <div formGroupName="sysUser">
          <div class="form-group">
            <label class="form-label">是否启用</label>
            <div class="form-input" id="form-input-switch">
              <label class="form-label __switch">
                  <input type="checkbox" name="unEnabled" formControlName="unEnabled" class="ng-pristine ng-untouched ng-valid">
                  <span class="switch"></span>
              </label>
            </div>
          </div>

          <div class="form-group">
            <label class="form-label">用户名</label>
            <div class="form-input">
              <input id="userName" name="userName" type="text" placeholder="请输入用户名" autocomplete="off" formControlName="userName">
            </div>
            <div *ngIf="formErrors.userName" class="form-error">
              {{ formErrors.userName }}
            </div>
          </div>

          <div class="form-group">
            <label class="form-label">姓名</label>
            <div class="form-input">
              <input id="realName" name="realName" type="text" placeholder="请输入姓名" autocomplete="off" formControlName="realName">
            </div>
            <div *ngIf="formErrors.realName" class="form-error">
              {{ formErrors.realName }}
            </div>
          </div>

          <div class="form-group">
            <label class="form-label">密码</label>
            <div class="form-input">
              <input id="passWord" name="passWord" type="password" placeholder="请输入密码" autocomplete="off" formControlName="passWord" (keyup)="onkeyup()">
            </div>
            <div *ngIf="formErrors.passWord" class="form-error">
              {{ formErrors.passWord }}
            </div>
          </div>

        </div>


        <div class="form-group">
          <label class="form-label">确认密码</label>
          <div class="form-input">
            <input id="confirmPassword" name="confirmPassword" type="password" placeholder="请再次输入密码" autocomplete="off"
              formControlName="confirmPassword" [(ngModel)]="confirmPasswords" (keyup)="onkeyup()">
          </div>
          <div *ngIf="showErrow" class="form-error">
            与密码不一致
          </div>
        </div>

        <div formGroupName="sysProfile">
          <div class="form-group">
            <label class="form-label">邮箱</label>
            <div class="form-input">
              <input id="email" name="email" type="text" placeholder="请输入邮箱" autocomplete="off" formControlName="email">
            </div>
            <div *ngIf="formErrors.email" class="form-error">
              {{ formErrors.email }}
            </div>
          </div>

          <div class="form-group">
            <label class="form-label">电话</label>
            <div class="form-input">
              <input id="telNo" name="telNo" type="text" placeholder="请输入电话" autocomplete="off" formControlName="telNo">
            </div>
            <div *ngIf="formErrors.telNo" class="form-error">
              {{ formErrors.telNo }}
            </div>
          </div>

          <div class="form-group">
            <label class="form-label">传真</label>
            <div class="form-input">
              <input id="faxNo" name="faxNo" type="text" placeholder="请输入传真" autocomplete="off" formControlName="faxNo">
            </div>
            <div *ngIf="formErrors.faxNo" class="form-error">
              {{ formErrors.faxNo }}
            </div>
          </div>

          <div class="form-group">
            <label class="form-label">用户角色</label>
            <div class="form-input">
              <select name="roleId" class="chosen-select" formControlName="roleId">
                 <option [value]="item?.roleId" *ngFor="let item of roles">
                {{item?.roleName}}
              </option>  
              </select>
            </div>
            <div *ngIf="formErrors.roleId" class="form-error">
              {{ formErrors.roleName }}
            </div>
          </div>

          <div class="form-group">
            <label class="form-label">组织机构</label>
            <div class="form-input">
              <select name="companyId" formControlName="companyId">
                <option [value]="company.companyId" *ngFor="let company of companyItmes">                                
                     <span> {{company.companyName}}</span> 
                </option>            
            </select>
            </div>
          </div>

          <div class="form-group">
            <label class="form-label">性别</label>
            <div class="form-input">
              <select name="sex" formControlName="sex" (change)="sexChange($event.target.value)">
                <!--(change)="sexChange()"-->
                <option [value]="0">                                
                     <span> 女</span> 
                </option>         
                <option [value]="1">                                
                     <span> 男</span> 
                </option>   
            </select>
            </div>
          </div>


        </div>




        <div class="form-group">
          <label class="form-label">允许的风场</label>
          <div class="form-control __checkbox">
            <label class="form-label" *ngFor="let farm of farms;">
                  <input type="checkbox" [checked]="farm?.isChecked" [value]="farm.farmId" (click)="farmIsChecked($event.target.checked,farm)">
                  <span class="check"></span>
                  <span class="name">{{farm.farmName}}</span>
              </label>
          </div>
        </div>
        <div class="form-group">
          <label class="form-label">用户头像</label>
          <div class="form-input">
            <img [src]="localhostPath +'/' + currentEntity?.sysProfile.icon" alt="">
          </div>
        </div>

       

      </form>
      <div class="file">
        <p-fileUpload [ngClass]="{'fileUpload-edit':!file}" name="file" (uploadHandler)="onUpload($event)" (onRemove)="onRemove($event)"
          cancelLabel="取消" chooseLabel="选择用户头像" accept="image/*" customUpload="true" auto="false"></p-fileUpload>
      </div>
    </div>
  </div>
</div>